using System.Collections.Generic;

namespace ActiveRecordSample.Entities
{
	// Business class Addres generated from Address
	// shvadskd [2008-10-20] Created

	using System;
	using System.ComponentModel;
	using Castle.ActiveRecord;

   [ActiveRecord("SalesLT.Address")]
	public  class Address 
		: ActiveRecordValidationBase<Address> 
	{

		#region Property_Names

		public static string Prop_AddressID = "AddressID";
		public static string Prop_AddressLine1 = "AddressLine1";
		public static string Prop_AddressLine2 = "AddressLine2";
		public static string Prop_City = "City";
		public static string Prop_StateProvince = "StateProvince";
		public static string Prop_CountryRegion = "CountryRegion";
		public static string Prop_PostalCode = "PostalCode";
		public static string Prop_rowguid = "rowguid";
		public static string Prop_ModifiedDate = "ModifiedDate";

		#endregion

		#region Private_Variables

		private int _addressid;
		private string _addressLine1;
		private string _addressLine2;
		private string _city;
		private string _stateProvince;
		private string _countryRegion;
		private string _postalCode;
		//private byte[] _rowguid;
		private DateTime _modifiedDate;

		//private IList<CustomerAddres> _CustomerAddress = new List<CustomerAddres>();
		//private IList<SalesOrderHeader> _SalesOrderHeader = new List<SalesOrderHeader>();		

		#endregion

		#region Constructors

		public Address()
		{
		}

		public Address(
			int p_addressid,
			string p_addressLine1,
			string p_addressLine2,
			string p_city,
			string p_stateProvince,
			string p_countryRegion,
			string p_postalCode,			
			DateTime p_modifiedDate)
		{
			_addressid = p_addressid;
			_addressLine1 = p_addressLine1;
			_addressLine2 = p_addressLine2;
			_city = p_city;
			_stateProvince = p_stateProvince;
			_countryRegion = p_countryRegion;
			_postalCode = p_postalCode;
			//_rowguid = p_rowguid;
			_modifiedDate = p_modifiedDate;
		}

		#endregion

		#region Properties

		[PrimaryKey("AddressID", Access = PropertyAccess.NosetterLowercaseUnderscore)]
		public int AddressID
		{
			get { return _addressid; }
		}

		[Property("AddressLine1", NotNull = true, Length = 60)]
		public string AddressLine1
		{
			get { return _addressLine1; }
			set { _addressLine1 = value; }
		}

		[Property("AddressLine2", Length = 60)]
		public string AddressLine2
		{
			get { return _addressLine2; }
			set { _addressLine2 = value; }
		}

		[Property("City", NotNull = true, Length = 30)]
		public string City
		{
			get { return _city; }
			set { _city = value; }
		}

		[Property("StateProvince", NotNull = true, Length = 50)]
		public string StateProvince
		{
			get { return _stateProvince; }
			set { _stateProvince = value; }
		}

		[Property("CountryRegion", NotNull = true, Length = 50)]
		public string CountryRegion
		{
			get { return _countryRegion; }
			set { _countryRegion = value; }
		}

		[Property("PostalCode", NotNull = true, Length = 15)]
		public string PostalCode
		{
			get { return _postalCode; }
			set { _postalCode = value; }
		}

      //[Property("rowguid", NotNull = true)]
      //public byte[] rowguid
      //{
      //   get { return _rowguid; }
      //   set { _rowguid = value; }
      //}

		[Property("ModifiedDate", NotNull = true)]
		public DateTime ModifiedDate
		{
			get { return _modifiedDate; }
			set { _modifiedDate = value; }
		}

   //[HasMany(typeof(CustomerAddres), Table="CustomerAddress", ColumnKey="AddressID")]
   //public IList<CustomerAddres> CustomerAddress
   //{
   //    get { return _CustomerAddress; }
   //    set { _CustomerAddress = value; }
   //}
   //[HasMany(typeof(SalesOrderHeader), Table="SalesOrderHeader", ColumnKey="BillToAddressID")]
   //public IList<SalesOrderHeader> SalesOrderHeader
   //{
   //    get { return _SalesOrderHeader; }
   //    set { _SalesOrderHeader = value; }
   //}
	
		#endregion

	} // Addres
}

